Vim set mark, jump back to mark
Chat GPT 4o 응답
In Vim, you can mark the current cursor position using the m{a-z} command, and jump back to it quickly. Here’s how to use it:
✅
Mark current position
ma
- m is the command to set a mark.
- a is a register (you can choose any letter a to z).
- This stores your current cursor position in mark a.
🚀
Jump to the mark
`a " Jump to exact position (line + column)"
'a " Jump to beginning of the line containing the mark"
- Use backtick (`) for exact cursor position.
- Use apostrophe (’) to jump to the line of the mark.
🧠 Pro tips
- Marks a–z are file-local.
- Marks A–Z are global across files (Vim saves the filename too).
- Use :marks to list all your current marks.
🧭 Use-case example:
- You’re editing a function.
- Set a mark: ma
- Jump to another place in the file.
- Need to return? Press `a or 'a.